
<template>
    <div >
        <el-table
                :data="tableData"
                stripe
                style="width: 100%">
            <el-table-column
                    prop="staffid"
                    label="员工工号">
            </el-table-column>
            <el-table-column
                    prop="staffname"
                    label="员工姓名">
            </el-table-column>
            <el-table-column
                    prop="address"
                    label="地址">
            </el-table-column>
            <el-table-column
                    prop="phone"
                    label="联系方式">
            </el-table-column>
            <el-table-column
                    prop="roleid"
                    label="职位">
            </el-table-column>
            <el-table-column
                    prop="deptid"
                    label="部门">
            </el-table-column>
        </el-table>
        <el-row>
            <el-col :span="24">
                <el-pagination
                        :page-sizes="[5, 10, 15, 20]"
                        :page-size="pageSize"
                        background
                        layout="total, sizes, prev, pager, next, jumper"
                        @current-change="findPage"
                        @size-change="findSize"
                        :total="total">
                </el-pagination>
            </el-col>
        </el-row>
    </div>
</template>

<script>
    export default {
        name: "staff",
        data() {
            return{
                tableData:[],
                total:0,
                pageSize:5,
                pageNow:1
            }
        },
        created() {
            this.findAllStaff()
        },
        methods:{
            findPage(page) {
                this.pageNow=page
                this.findAllStaff()
            },
            findSize(size) {
                this.pageSize=size
                this.findAllStaff()
            },
            findAllStaff() {
                var that = this;
                var pageSize = this.pageSize;
                var pageNow = this.pageNow;
                this.$http.get("http://localhost:8008/staff/getAllStaff?pageSize="+pageSize+"&pageNow="+pageNow).then(function (result) {
                    console.log(result)
                    that.tableData=result.data.data
                    that.total=result.data.count
                })
            }
        }
    }
</script>

<style scoped>

</style>